package com.ruoyi.douyin.controller.open;

import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.douyin.service.open.VideoOpenDataService;
import com.ruoyi.douyin.vo.VideoOpenDataVideoDataVo;
import com.ruoyi.system.domain.vo.VideoBaseInfoVo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

@RestController
@RequestMapping("/douyin/open/data/video")
public class VideoOpenData {

    @Autowired
    private VideoOpenDataService videoOpenDataService;

    /**
     * 视频30天的基础数据
     */
    @PostMapping("base")
    public AjaxResult baseData(@RequestBody VideoBaseInfoVo videoBaseInfoVo) {
        return videoOpenDataService.baseData(videoBaseInfoVo.getOpenId(), videoBaseInfoVo.getItemId());
    }

    /**
     * 获取视频点赞数据
     */
    @PostMapping("like")
    public AjaxResult likeData(@RequestBody VideoOpenDataVideoDataVo videoOpenDataVideoDataVo) {
        return videoOpenDataService.otherData(videoOpenDataVideoDataVo, "like");
    }

    /**
     * 获取视频评论数据
     */
    @PostMapping("comment")
    public AjaxResult commentData(@RequestBody VideoOpenDataVideoDataVo videoOpenDataVideoDataVo) {
        return videoOpenDataService.otherData(videoOpenDataVideoDataVo, "comment");
    }

    /**
     * 获取视频播放数据
     */
    @PostMapping("play")
    public AjaxResult playData(@RequestBody VideoOpenDataVideoDataVo videoOpenDataVideoDataVo) {
        return videoOpenDataService.otherData(videoOpenDataVideoDataVo, "play");
    }

    /**
     * 获取视频分享数据
     */
    @PostMapping("share")
    public AjaxResult shareData(@RequestBody VideoOpenDataVideoDataVo videoOpenDataVideoDataVo) {
        return videoOpenDataService.otherData(videoOpenDataVideoDataVo, "share");
    }
}
